#import "../Stone3DAPI/Stone3D.h"
#import "GetUVValue.h"

@implementation GetUVValue

- loadNib
{
    id bfc=[NXBundle bundleForClass:[self class]];
    char path[MAXPATHLEN+1];
    
    [bfc getPath:path forResource:[self name] ofType:"nib"];
    
    [NXApp loadNibFile:path owner:self
		withNames:NO fromZone:[self zone]];
		
    return self;
}


static id one = nil;
+ instance 
{
    if (!one)  {
	one = self = [super new];
	[self loadNib];
    } else self = one;
    return self;
}

- (BOOL)runModalForControl:(int *)u :(int *)v
{
    BOOL retVal = YES;
    
    [uField setIntValue:*u];
    [vField setIntValue:*v];
    [pointMatrix selectCell:uField];
    if ([NXApp runModalFor:window]==NX_RUNSTOPPED) {
	*u = [uField intValue];
	*v = [vField intValue];
    }
    [window orderOut:self];
    if (!oked) retVal = NO;
    return retVal;
}


- revert:sender
{
    oked = NO;
    [NXApp abortModal];
    return nil;
}


- ok:sender
{
    oked = YES;
    [NXApp stopModal];
    return self;
}

@end
